package com.lkei.entity;

import com.lkei.utils.TimeToTimeStampUtils;
import lombok.*;

/**
 * 消息列表实体类
 * @author 周贵有
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class MessageList implements Comparable<MessageList> {
    /**
     *  消息编号
     */
    private Integer id;
    private String message_title;
    private String time;
    private boolean type;
    private String receiver;



    @SneakyThrows
    @Override
    public int compareTo(MessageList o) {
        long x = TimeToTimeStampUtils.dateToStamp(this.time);
        long y = TimeToTimeStampUtils.dateToStamp(o.getTime());
        if(y<x){
            return 1;
        }else if(y==x){
            return 0;
        }else {
            return -1;
        }
    }
}
